<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<link href="css/bootstrap.min.css" rel="stylesheet"/>
		<title>转换器</title>
		<!--<script src="js/converter.js"></script>-->
		<script type="text/javascript">
        function convert() {
            var num = prompt('请输入一个十进制非负整数：', '52');
            var temp = num;
            var arr = new Array();
            for (var i = 0; 1; i++) {
                if (num / 2 >= 1) {
                    arr[i] = num % 2;
                    num = parseInt(num / 2);
                } else {
                    arr[i] = 1;
                    break;
                }
            }
            document.write('十进制的' + temp + '转化成二进制为：');
            for (i = arr.length; i > 0; i--) {
                document.write(arr[i-1]);
            }
        }
        convert();
    </script>
	</head>
	<body>
		<!--<div class="col-md-6 col-md-offset-3" style="border: 1px solid black;">
			<h1>十进制转二进制</h1>
			<h3>请输入十进制数：</h3>
			<input id="decimalism" class="form-control" type="text"/>
			<button class="btn btn-success" onclick="converter()" style="margin-top: 1em;">转换</button>
			<h3>转化：</h3>
			<input id="binary" class="form-control" type="text" style="margin-bottom: 2em;"/>
		</div>-->
	</body>
	<!--<script src="js/jquery.min.js"></script>
	<script src="js/bootstrap.min.js"></script>-->
</html>
